/*
 * Bonus.cpp
 *
 *  Created on: Jun 12, 2012
 *      Author: gonzalo
 */

#include "Bonus.h"
#include "../../../common/utils/GameUtils.h"
#include "../PlayScenarioPanel.h"
#include "../../../common/utils/GameUtils.h"

Bonus::Bonus(BonusType type, int posX,int posY,std::string imagePath,float duration,Widget* parent)
:WidgetMovimiento(BONUS,posX,posY,imagePath, parent,BONUS_DEFAULT_DAMAGE){
	this->bonusType = type;
	this->duration = duration;
}

void Bonus::handleColision(WidgetMovimiento* with){
	if(with->getType() == SHIP && this->drawable){
		Ship* ship = (Ship*)with;

		this->drawable = false;

		ship->handleBonus(this);
	}
}

void Bonus::updatePosicion(int posX,int posY){
	parcel->updateXY(posX,posY);
}

BonusType Bonus::getBonusType() const
{
    return bonusType;
}

DTOBonus* Bonus::getDTO(std::string owner) {
	SDL_Rect rectangle = parcel->getRectangle();
	return new DTOBonus(getBonusType(), rectangle.x, rectangle.y, owner);
}

Bonus::~Bonus(){
	this->surfaceShown = NULL;
}
